
import moment from "moment";
import { PredictionStatus } from '../../../utils/constant.js'
const OrderListSearchKeys = [
    {
        key: "orderNos",
        label: "订单号",
        placeholder: "请输入订单号按enter回车支持多个订单查询",
        textarea: true,
        rules: [{
            required: false
        }],
    },
    {
        key: "userName",
        label: "用户名",
        placeholder: "请输入用户名",
        input: true,
        rules: [{
            required: false
        }],
    },
    {
        key: "skuName",
        label: "商品名称",
        advinced:'yes',
        placeholder: "请输入商品名称",
        input: true,
        rules: [{
            required: false
        }],
    },
    {
        key: "status",
        label: "状态",
        advinced:'yes',
        placeholder: "请选择状态",
        select: true,
        rules: [{
            required: false
        }],
    },
]
const OrderListColumn =[
    { title: '订单号', width: 180, fixed: 'left', align: 'center', scopedSlots: {customRender: 'orderNo'} }, 
    { title: '用户名', width: 70, dataIndex: 'userName',  align: 'center' }, 
    { title: '业务员', width: 70, dataIndex: 'salesman', align: 'center' }, 
    { title: '数量', width: 50, dataIndex: 'qty', align: 'center' }, 
    { title: '国家', width: 50, dataIndex: 'country', align: 'center' }, 
    { title: '订单金额(总价)', width: 100, dataIndex: 'orderAmount', align: 'center' }, 
    // { title: '设计图地址', width: 200, align: 'center', scopedSlots: {customRender: 'designUrl'} }, 
    // { title: '效果图地址', width: 200, align: 'center', scopedSlots: {customRender: 'effectUrl'} }, 
    { title: '支付方式', width: 80, dataIndex: 'payType', align: 'center' }, 
    { title: '物流等级', width: 80, dataIndex: 'logisticsLevel', align: 'center' }, 
    // { title: '邮箱', width: 120, dataIndex: 'email', align: 'center' }, 
    { title: '订单状态', width: 80, dataIndex: 'status',align: 'center'},
    { title: '公司名称', width: 80, dataIndex: 'companyName',align: 'center' },
    // { title: '其他参数2', dataIndex: 'extend2', width: 100, align: 'center' },
    // { title: '其他参数3', dataIndex: 'extend3', width: 100, align: 'center' },
    { title: '操作', width: 200, fixed: 'right', align: 'center', scopedSlots: { customRender: 'operation' } }
]
const listModalKeys = [
    {
        key: "orderNo",
        label: "订单号",
        placeholder: "请填写订单号",
        input: true,
        disabled: true,
        maxLength: 100,
        rules: [{
            required: true,
            message: '请填写订单号'
        }],
    },
    {
        key: "userName",
        label: "用户名",
        placeholder: "请填写用户名",
        input: true,
        maxLength: 100,
        rules: [{
            required: false,
            message: '请填写用户名'
        }],
    },
    {
        key: "skuName",
        label: "商品名称",
        placeholder: "请填写商品名称",
        input: true,
        maxLength: 100,
        rules: [{
            required: false,
            message: '请填写商品名称'
        }],
    },
    {
        key: "qty",
        label: "数量",
        placeholder: "数量",
        inputNumber: true,
        rules: [{
            required: false,
            message: '数量'
        }],
    },
    {
        key: "price",
        label: "单价",
        placeholder: "单价",
        inputNumber: true,
        rules: [{
            required: false,
            message: '单价'
        }],
    },
    {
        key: "freight",
        label: "运费",
        placeholder: "运费",
        inputNumber: true,
        rules: [{
            required: false,
            message: '运费'
        }],
    },
    {
        key: "designUrl",
        label: "设计图地址",
        placeholder: "请填写设计图地址",
        input: true,
        maxLength: 100,
        rules: [{
            required: false,
            message: '请填写设计图地址'
        }],
    },
    {
        key: "effectUrl",
        label: "效果图地址",
        placeholder: "请填写效果图地址",
        input: true,
        maxLength: 100,
        rules: [{
            required: false,
            message: '请填写效果图地址'
        }],
    },
    {
        key: "addr1",
        label: "地址1",
        placeholder: "请填写地址1",
        input: true,
        maxLength: 100,
        rules: [{
            required: false,
            message: '请填写地址1'
        }],
    },
    {
        key: "addr2",
        label: "地址2",
        placeholder: "请填写地址2",
        input: true,
        maxLength: 100,
        rules: [{
            required: false,
            message: '请填写地址2'
        }],
    },
    {
        key: "email",
        label: "邮箱",
        placeholder: "请填写邮箱",
        input: true,
        maxLength: 100,
        rules: [{
            required: false,
            message: '请填写邮箱'
        }],
    },
    {
        key: "extend1",
        label: "其他参数1",
        placeholder: "请填写其他参数1",
        input: true,
        maxLength: 100,
        rules: [{
            required: false,
            message: '请填写其他参数1'
        }],
    },
    {
        key: "extend2",
        label: "其他参数2",
        placeholder: "请填写其他参数2",
        input: true,
        maxLength: 100,
        rules: [{
            required: false,
            message: '请填写其他参数2'
        }],
    },
    {
        key: "extend3",
        label: "其他参数3",
        placeholder: "请填写其他参数3",
        input: true,
        maxLength: 100,
        rules: [{
            required: false,
            message: '请填写其他参数3'
        }],
    },
    {
        key: "status",
        label: "状态",
        placeholder: "请选择状态",
        select: true,
        rules: [{
            required: false,
            message: '请选择状态'
        }],
    },
]

const PredictionListColumn = [
    { title: '订单号', width:160, dataIndex: 'orderNo', align: 'center', },
    { title: '订单金额', dataIndex: 'orderAmount',  align: 'center' },
    { title: '预报状态', dataIndex: 'predictionStatus', align: 'center', scopedSlots: { customRender: 'predictionStatus' } },
    { title: '失败原因', width:160, dataIndex :'failReason',align:'center', customRender: (text,record) => { return record.predictionStatus == 3? '-':( text || '-')}},
    { title: '用户名',  dataIndex: 'userName', align: 'center', scopedSlots: { customRender: 'userName' } },
    { title: '运单号', width:140, dataIndex: 'waybillNumber', align: 'center' },
    { title: '包裹号', width:140,  dataIndex: 'packageNo', align: 'center' },
    { title: '操作', align: 'center', dataIndex: '', scopedSlots: { customRender: 'operation' } }
]

const OrderPhotoSearchKeys = [
    {
        key: "type",
        label: "图片类型",
        placeholder: "请选择图片类型",
        select: true,
        rules: [{
            required: false
        }],
    },
    {
        key: "orderNos",
        label: "订单号",
        placeholder: "请输入订单号按enter回车支持多个订单查询",
        textarea: true,
        rules: [{
            required: false
        }],
    },
    {
        key: "userName",
        label: "用户名",
        placeholder: "请输入用户名",
        input: true,
        advinced:'yes',
        rules: [{
            required: false
        }],
    },
    {
        key: "status",
        label: "状态",
        advinced:'yes',
        placeholder: "请选择状态",
        select: true,
        advinced:'yes',
        rules: [{
            required: false
        }],
    },
]
const OrderPhotoColumn =[
    { title: '图片编号', width: 120, align: 'center', dataIndex: 'picNo', customRender: text => { return text || '-'} },
    { title: '图片类型', width: 100, align: 'center', scopedSlots: {customRender: 'type'} },
    { title: '图片源地址', width: 140, align: 'center', scopedSlots: {customRender: 'picSource'} },
    { title: '图片链接', width: 140, align: 'center', scopedSlots: {customRender: 'url1'}},
    { title: '图', width: 100, align: 'center', scopedSlots: {customRender: 'url2'}},
    { title: '订单号', width: 100, align: 'center', dataIndex: 'orderNo' },
    { title: '用户名', width: 80, align: 'center', dataIndex: 'userName' },
    { title: '商品名称', width: 100, align: 'center', dataIndex: 'skuName' },
    { title: '下载状态', width: 120, align: 'center', scopedSlots: {customRender: 'status'} },
    { title: '原因', width: 120, align: 'center', scopedSlots: {customRender:'errorMsg'}},
    { title: '操作', width: 140, align: 'center', fixed: 'right', scopedSlots: {customRender: 'operation'}}
]
const PhotoModalKeys = [
    {
        key: "type",
        label: "图片类型",
        placeholder: "请选择图片类型",
        select: true,
        rules: [{
            required: false,
            message: '请选择图片类型'
        }],
    },  
    {
        key: "picSource",
        label: "图片源地址",
        placeholder: "请填写图片源地址",
        input: true,
        maxLength:100,
        rules: [{
            required: false,
            message: '请填写图片源地址'
        }],
    },  
    {
        key: "url1",
        label: "图片链接",
        placeholder: "请填写图片链接",
        input: true,
        maxLength:100,
        rules: [{
            required: false,
            message: '请填写图片链接'
        }],
    },  
    {
        key: "url2",
        label: "图",
        placeholder: "",
        input: true,
        rules: [{
            required: false,
            message: '图'
        }],
    }, 
    {
        key: "userName",
        label: "用户名",
        placeholder: "用户名",
        inputNumber: true,
        rules: [{
            required: false,
            message: '用户名'
        }],
    }, 
    {
        key: "skuName",
        label: "商品名称",
        placeholder: "商品名称",
        inputNumber: true,
        rules: [{
            required: false,
            message: '商品名称'
        }],
    }, 
    {
        key: "errorMsg",
        label: "原因",
        placeholder: "请填写原因",
        textarea: true,
        maxLength:200,
        rules: [{
            required: false,
            message: '请填写原因'
        }],
    },  
]

const OrderDownloadSearchKeys = [
    {
        key: "orderNos",
        label: "订单号",
        placeholder: "请输入订单号按enter回车支持多个订单查询",
        textarea: true,
        rules: [{
            required: false
        }],
    },
    {
        key: "userName",
        label: "用户名",
        placeholder: "请输入用户名",
        input: true,
        rules: [{
            required: false
        }],
    },
]
const OrderDownloadColumn =[
    { title: '订单号', width:90, dataIndex: 'orderNo', align: 'center' },
    { title: '用户名', width:90, dataIndex: 'userName', align: 'center', customRender: text => { return text || '-'}},
    { title: '状态', width:90, dataIndex: 'status', align: 'center' },
    { title: '下载链接',width:160,  align: 'center', scopedSlots: {customRender: 'url'} },
    { title: '创建时间',width:90,  align: 'center', dataIndex: 'createTime',customRender:text =>{return moment(text).format('YYYY-MM-DD hh:mm:ss')} }, 
]

const  MergeSearchKeys = [
    {
        key: "address",
        label: "地址",
        placeholder: "请输入地址",
        input: true,
        rules: [{
            required: false
        }],
    },
    {
        key: 'dates',
        label: '订单日期',
        format: "YYYY-MM-DD HH:mm:ss",
        placeholder: '订单日期',
        dates: true,
        showTime:true,
        rules: [{
            required: false,
        }]
    },
]
const MergeColumn = [
    { title: '订单日期', dataIndex: 'orderTime', align: 'center', },
    { title: '用户名称', dataIndex: 'userName',  align: 'center' },
    { title: '订单数', dataIndex: 'num', align: 'center' },
    { title: '平台', dataIndex :'channel',align:'center' },
    { title: '渠道',  dataIndex: 'shipMethod', align: 'center' },
    { title: '收货地址', width:200, dataIndex :'address',align:'center' }, //customRender: (text,record) => { return text+' ' + record.state + ' '+record.city+' '+record.street} 
]
const MergeInnerColumn = [
    { title: 'ID',  dataIndex: 'id', align: 'center' },
    { title: '订单号', dataIndex: 'orderNo', align: 'center', },
    { title: '订单金额', dataIndex: 'orderAmount',  align: 'center' },
    { title: '预报状态', dataIndex: 'predictionStatus', align: 'center', customRender: text => { let tem = PredictionStatus.filter(item =>{return item.id == text}); return tem[0] && tem[0].name ? tem[0].name : ''}   },
    { title: '用户名', dataIndex :'userName',align:'center' },
    { title: '包裹号',  dataIndex: 'packageNo', align: 'center' },
]

export {
    OrderListSearchKeys, OrderListColumn, listModalKeys,
    OrderPhotoSearchKeys, OrderPhotoColumn, PhotoModalKeys,
    OrderDownloadSearchKeys, OrderDownloadColumn,PredictionListColumn,
    MergeSearchKeys, MergeColumn, MergeInnerColumn
}